#pragma once

#include <iostream>

class computer
{
public:
    computer(int _x, int _y, char _por) : x(_x), y(_y), por(_por)
    {
    }
    computer() {}

    int fun()
    {
        int result = 0;
        switch (por)
        {
        case '+':
            result = x + y;
            break;
        case '-':
            result = x - y;
            break;
        case '*':
            result = x * y;
            break;
        case '/':
            if (y == 0)
            {
                std::cout << "除0错误" << std::endl;
                return -1;
            }
            result = x / y;
            break;
        default:
            break;
        }
        return result;
    }

public:
    int x;
    int y;
    char por;
};